<?php

class Pager
{
	private $start;
	private $total;
	private $url;
	
	const SIZE = 5;
	const LIMIT = 5;
	
	public function setStart($start) {
		$this->start = $start;
	}
	
	public function getStart() {
		return $this->start;
	}
	
	public function setTotal($total) {
		$this->total = $total;
	}
	
	public function getTotal() {
		return $this->total;
	}
	
	public function setURL($url) {
		$this->url = $url;
	}
	
	public function getURL() {
		return $this->url;
	}
	
	public static function getSize() {
		return  self::SIZE;
	}
	
	public static function getLimit() {
		return self::LIMIT;
	}
	
	public function isPreviousEnable() {
		return $this->start >= self::SIZE;
	}
	
	public function getNextPage() {
		return ($this->start/self::LIMIT)+2;
	}
	
	public function getPrevPage() {
		return ($this->start/self::LIMIT);
	}
	
	public function isNextEnable() {
		return $this->total > ($this->start + self::SIZE);
	}
	
	public function getPageNumber() {
		return ceil(($this->start + 1) / self::SIZE);  //to avoid 0 index
	}
	
	public function getNumberOfPages() {
		return ceil($this->total / self::SIZE);
	}
	
	public function getActivePosition() {
		return ceil((self::LIMIT + 1) / 2);
	}
	
	public function initPager($start,$total) {
		$this->start = $start;
		$this->total = $total;
	}
}
